home *** CD-ROM | disk | FTP | other *** search
- FLOW CONTROL
- Last update: 28 Oct 1994
-
- Q: What is flow control?
-
- A: Let's start by saying the Flow Control (FC) is necessary because the
- port speed (DTE-DCE), or computer to modem) is frequently higher than the
- carrier speed (DCE-DCE, or modem to modem) when using a high-speed,
- data-compressing modem. In these types of connections, the user sets the
- computer to feed the modem data at 57600 or 19200 bps, but the data leaves
- the modem at only 9600 or 2400 on the phone wire. Data accumulates in the
- modem, and when it's memory is full, it has to say STOP or corrupt the
- data. The communications program sees this signal, and stops until told
- it's ok to resume. That, in a nutshell, is flow control..
-
- Or, the comm program may be writing to disk and wants to tell the modem STOP
- for a minute. This communication between the modem and the software is flow
- control. It may even come from the other computer. For example, if your
- comm program says STOP, your modem stops. It then has to tell the other
- modem to stop because it obviously can't hold an infinite amount of data.
- V.42 error control provides that mechanism between modems. The other modem
- has to tell the host program to stop. So, flow control is very important.
-
- Q: What types of flow control are possible?
-
- A: There are three different forms of "flow control":
- 1) end-to-end
- 2) modem-to-modem
- 3) local
-
- Only the third one can be handled by RTS/CTS which are signals on the RS232
- interface between the modem and the local computer.
-
- Any form of flow control which exists across the telephone line MUST be
- 'in-band.' That is, it must be part of the data flow and detected as being
- 'something special.' This is how XON/XOFF works. These special characters
- are inserted into the data stream and the application at each end will see
- these and respond to them.
-
- The modem to modem flow control is handled by the error control protocol
- and it too is done with 'special characters' or a group of special
- characters which are embedded into the the data stream.
-
- Any software application where the error control (and buffering) functions
- are being used by the local modem will require local flow control. The
- cable, the software application, and the modem initialization must all be
- set to do the same thing. The default on the high-speed modems from PPI
- will be for hardware flow control. (&K3).
-
- Q: What do RTS/CTS and XON/XOFF flow control stand for? Which is preferable,
- hardware or software handshaking flow control?
-
- A: Hardware flow control is simply faster than XON/XOFF flow control and
- does not add overhead to the computer's processing load. Hardware FC
- wiggles voltages on the RTS and CTS wires (ReadyToSend, ClearToSend) in
- the modem cable. Even internal modems have modem cables, even if it is
- very short lines on the modems printed circuit board. The internal modem
- has the 16550 uart chip, just like in a serial board for an external modem,
- and these wires come out of the UART chip. Voltage variations are
- instantaneous.
-
- Software flow control sends extra characters that are not instantaneous
- as they require processing by the serial device. A user may be familiar
- with using XON/XOFF manually. There are several names for the XON/XOFF
- flow control characters:
-
- hex 13 decimal 19 DC3 XOFF CTRL-S Stop sending, Xmission Off
- hex 11 decimal 17 DC1 XON CTRL-Q Resume sending, Xmission On
-
- "Xmission" is equivalent to "Transmission" in this description. The ASCII
- specifications call these control chars DC1 and DC3 (Device Control). Back
- when digital data was stored on audio cassettes, computer operators used
- these characters to start and stop the tape drives (devices).
-
- If one is using an ASCII terminal emulator (regular old communications
- program like Procomm) to read CIS messages, one can manually use CTRL-S
- to stop the scrolling of ASCII messages (so the data can read them before
- they scroll off the screen, for example), and CTRL-Q to resume.
- Essentially, the action is flow control. If one is using &K3 and Hardware
- local flow control ("local" describing the computer to modem connection,
- as opposed to between the modems themselves), these CTRL characters simply
- pass through the modem as data, and the host sees them and stops (if the
- host is set up to recognize flow control, while flow control on the modem
- itself is disabled). If one is using &K4, and XON/XOFF local flow control,
- the modem will see the flow control characters and stop, informing the other
- modem, which informs the host. The host, having been instructed to stop,
- stops.
-
- With XON/XOFF flow control, the modem or comm driver probably has a few
- hundred characters buffered up when it wants to report busy, and there is
- the problem of getting the XOFF character to the top of the queue. Also, a
- 16550 UART in the serial I/O controller card might already have 16
- characters in it, and your XOFF has to get in line and wait. Plus, these
- characters are additional overhead, additional characters you must send, and
- they take time to send a bit at a time.
-
- Hardware is instantaneous and adds no overhead, but requires a modem cable
- with a couple more wires in it. It is called "out of band" signaling,
- because it is done via other means outside the data channel.
-
- Q: Speaking of UARTs, how does the UART figure into flow control?
-
- A: In a RTS/CTS flow control situation, when the computer drops RTS, the
- modem can stop sending the computer data as soon as it finishes outpulsing
- the current character; but if the computer sends an XOFF to the modem, the
- XOFF would go into the UART's buffer (and if the 16550 FIFO gets loaded up,
- all preceeding characters in the Transmit FIFO have to be sent first before
- the UART even starts to outpulse the Xoff), then the UART has to outpulse
- the XOFF and the modem receive the entire XOFF character before it can
- recognize it as an XOFF and stop sending the computer data as soon as the
- modem finishes the character it is currntly sending to the computer.
-
- Likewise, in the other direction, when the modem drops CTS, the
- communications program can stop stuffing the UART's Transmit Buffer
- immediately, but what is in the UART's Transmit Buffer (and, for the 16550,
- in the Transmit FIFO) will still be sent to the modem anyway. (That is why,
- when RTS/CTS flow control is used, the modem will drop CTS when its buffer
- is _nearly_ full, not when the buffer is completely full--the communications
- program has no decent way of flushing the 16550 Transmit FIFO so the modem
- could still receive 16 bytes after the modem drops CTS.) But with XON/XOFF
- flow control, when the modem sends the comptuer an XOFF, it has to be
- outpulsed, stuffed in the UART's Receive Buffer (and for the 16550, the
- Receive FIFO, which can hold 16 bytes), and it is possible that the
- communications program won't even grab data from the Receive FIFO buffer
- until another 3, 7, or 13 characters are received, and then there are still
- possibly 16 characters in the 16550's Transmit FIFO buffer when it does
- finally act on the XOFF, so up to 30 or so characters could be sent to
- the modem from the time the modem had sent the XOFF until the time data
- flow actually stops.
-
- Q: Does the speed of RTS/CTS vs. XON/XOFF matter? Is XON/XOFF more reliable?
-
- A: The overall speed gain of RTS/CTS vs XON/XOFF may not make a major impact
- on transfer results; furthermore, exact differences depend largely on the
- processor speed of the computer, the attached UART, and a number of local
- factors. Is XON/OFF more reliable? Not as long as the XON and XOFF
- characters are strictly between the computer and its attached modem.
- However, if an XON or especially an XOFF comes from some source other than
- local flow control, there can be problems. For example, line noise that
- just happens to "look like" an XOFF (Ctrl-S) will "freeze" the
- communications session. (That is why if one is using XON/XOFF flow control,
- one should use a modem<->modem error correction protocol if possible. Has
- anyone wondered why there are occasional freezes when using &Q0&K4 or
- &Q6&K4? Or a file transfer protocol that assumes 8-bit transparency
- will usually have problems with binary files or transmitting block #19
- (ASCII 19 = Ctrl-S = XOFF). Fortunately, both Z-modem and CompuServe-B+
- transfer protocols will "quote" XON and XOFF (i.e., substitute other
- codes so an ASCII 19 or ASCII 17 is not actually transmitted) so Z-modem
- and CompuServe-B+ can be used even when using XON/XOFF local flow control.
-
- But those who try Xmodem, 1K-Xmodem, Ymodem, 1K-Xmodem-g, or Ymodem-g
- when using local Xon/Xoff flow control are in for a different story entirely.
-
- Q: Does selection of file transfer protocol affect flow control?
-
- A: No, the file transfer protocol (X-, Y-, Z-modem or CIS B+) does not
- affect the choice of flow control, but it can indirectly make it less
- important. X- and Y-modem and CIS B+ sends one data block (or two for
- WinCIM B+) and then will wait until the ACK (acknowledgement) from the
- receiver is sent back before sending the next data. That slows flow
- greatly, and makes flow control far less important. The modem empties, and
- only then is the ACK received back from the other end and only then is more
- data sent. But it is not the same thing as flow control.
-
- Z-modem and Y-modem-G are extremely dependent on proper flow control, the
- protocols won't work otherwise. These protocols dont send ACKS, the sender
- simply starts pumping data out as fast as possible. If an error is detected,
- the receiver sends a NAK (negative acknowledgment) if Z-modem or aborts if
- Y-modem-G, but otherwise there is no stopping. Flow control becomes
- extremely important at that point. Because of this, Z-Modem and Y-Modem-G
- are the fastest protocols. Proper flow control is most important during
- uploading. When downloading, if the communications program can keep up,
- flow control is rarely exercised.
-
- Q: I set up flow control in my software. Do I have to configure my modem
- for it?
-
- A: The modem flow control and the software flow control must match because
- it is a communication between them. If using &K4, for example, one must
- set the software to XON/XOFF flow control. In the case of WinCIM, that's
- set in the Windows Control Panel. If &K4 is not used, &F includes the
- default &K3, and the software should also be set to Hardware.
-
- If flow control is set wrong, the modem and the software cannot
- communicate. The modem will cry STOP, and no one will hear (in cyberspace,
- no one can hear a modem screaming <g>). Characters are lost because the
- modem simply can't store any more. Typically, instead of losing a random
- character now and then like a UART overrun, big blocks of characters are
- lost, several hundred perhaps.
-
-
-